package com.autumn.aitraffic.api;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@Accessors(chain = true)
public class Result implements Serializable {
    private int code;
    private String message;
    private Object data;

    public static Result succ(String message, Object data) {
        Result r = new Result();
        r.setCode(200).setMessage(message).setData(data);
        return r;
    }

    public static Result fail(String message, Object data) {
        Result r = new Result();
        r.setCode(404).setMessage(message).setData(data);
        return r;
    }

    public static Result unauthorize(String message, Object data) {
        Result r = new Result();
        r.setCode(401).setMessage(message).setData(data);
        return r;
    }
}
